<SCRIPT LANGUAGE="JavaScript">
<!--
/**
*	
*/
function f_gridDblFunc(keyID) {
	var curKeyID = trselObj.f_get_select_key();

	curKeyID = curKeyID[0];
	if (curKeyID == "") return ;
	var CostUnitID = trselObj.f_getTDValueByKeyName(curKeyID ,"v_finance_inci_purc_deta.cost_unit_id");
	var ProviderID = trselObj.f_getTDValueByKeyName(curKeyID ,"v_finance_inci_purc_deta.provider_id");
	var MateDiff = trselObj.f_getTDValueByKeyName(curKeyID ,"v_finance_inci_purc_deta.material_diff");
	var where_sql = "finance_inci_purc_deta.provider_id = ? and finance_inci_purc_deta.cost_unit_id = ? and finance_inci_purc_deta.material_diff = ? ";
	var where_type = "string;string;string";
	var where_value = ProviderID+";"+CostUnitID+";"+MateDiff;

	//alert("curKeyID = " + curKeyID);
	//alert("curKeyID"+curKeyID);
	//alert("carriage_mode"+carriage_mode);
	var yearMonth = document.all("extend_param").value;
	if (yearMonth != "") {
		var whereMonth = yearMonth.split("-")[1];
		//alert(whereMonth);
		var whereYear = yearMonth.split("-")[0];
		if (whereMonth != "") {
			var aflag = whereYear + "-" + whereMonth;
			where_sql += " and finance_inci_purc_deta.account_flag = '"+ aflag +"'";
		}
	}
	var contextPath = "<%=CONTEXTPATH%>";
	var funcid = "GROUPAUDIT_INCI_PURC";

//	var href = contextPath + g_layoutForm + funcid + "&pageType=subgrid";
	var href = contextPath + "/wzmis/finance/frame_groupaudit_purc_carr.jsp?funcid=" + funcid + "&pageType=grid";
	href += "&where_sql=" + where_sql;
	href += "&where_value=" + where_value;
	href += "&where_type=" + where_type;
	href += "&orgwhere_sql=" + where_sql;
	href += "&orgwhere_type=" + where_type;
	href += "&orgwhere_value=" + where_value;
	//alert("href = " + href);

	parent.frames("frmformdata").document.location = href
}

function f_setGrid() {
	f_setAccountFlag();
}

function f_setAccountFlag() {
	//alert(document.all("extend_param").value);
	var yearObj = document.all("txtYear");
	var monthObj = document.all("selMonth");
	var yearMonth = document.all("extend_param").value;

	if (yearMonth != "") {
		yearObj.value = yearMonth.split("-")[0];
		monthObj.value = yearMonth.split("-")[1];
	} else {
		var curdate = new Date();
		yearObj.value = curdate.getYear();
		var curMonth = curdate.getMonth() + 1;
		if (curMonth.length == 1) curMonth = "0" + curMonth;
		monthObj.value = ""//curMonth;
	}
}

function f_month_where() {
	//alert(document.all("where_sql").value + "||" + document.all("orgwhere_sql").value);
	//var where_sql = "to_char(in_material.in_date ,'yyyy-mm') = ?";
	 var where_sql = "account_flag = ?";

	var orgwhere_sql = document.all("orgwhere_sql").value;
	var orgwhere_value = document.all("orgwhere_value").value;
	var orgwhere_type = document.all("orgwhere_type").value;

	if (orgwhere_sql == "") {
		orgwhere_sql = document.all("where_sql").value;
		orgwhere_value = document.all("where_value").value;
		orgwhere_type = document.all("where_type").value;

		document.all("orgwhere_sql").value = orgwhere_sql;
		document.all("orgwhere_value").value = orgwhere_value;
		document.all("orgwhere_type").value = orgwhere_type;
	}

	var yearObj = document.all("txtYear");
	var monthObj = document.all("selMonth");

	var where_value = yearObj.value + "-" + monthObj.value;
	document.all("extend_param").value = where_value;
	var where_type = "string";

	if (orgwhere_sql != "") {
		where_sql = where_sql + " and (" + orgwhere_sql + ")";
		where_value += ";" + orgwhere_value;
		where_type += ";" + orgwhere_type;
	}

	if (monthObj.value == "") {
		where_sql = orgwhere_sql;
		where_value = orgwhere_value;
		where_type = orgwhere_type;
	}

	document.all("where_sql").value = where_sql;
	document.all("where_value").value = where_value;
	document.all("where_type").value = where_type;

	var contextPath = "<%=CONTEXTPATH%>";
	var funcid = "GROUPAUDIT_INCI_PURC";

	var href = contextPath + g_layoutForm + funcid + "&pageType=subgrid";
	href += "&where_sql=" + "notDoQuery";
	href += "&where_value=" + "";
	href += "&where_type=" + "";
	href += "&orgwhere_sql=" + "notDoQuery";
	href += "&orgwhere_type=" + "";
	href += "&orgwhere_value=" + "";
	//alert("href = " + href);

	parent.frames("frmformdata").document.location = href
	f_reloadPage();
}
//-->
</SCRIPT>
<table class="gridTbl">
<tr class="gridData">
	<td class="gridData" >
	<eam:message key="account.flag" />: 
	<input type="text" name="txtYear" id="txtYear" size="5" value=""> -
	<select name="selMonth" id="selMonth" onchange="f_month_where(this);">
	<option value=""></option>
	<option value="01">01</option>
	<option value="02">02</option>
	<option value="03">03</option>
	<option value="04">04</option>
	<option value="05">05</option>
	<option value="06">06</option>
	<option value="07">07</option>
	<option value="08">08</option>
	<option value="09">09</option>
	<option value="10">10</option>
	<option value="11">11</option>
	<option value="12">12</option>
	</select>
	</td>
</tr>
</table>